package com.clm.mapper;

import com.clm.entity.SetmealDish;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;

import java.util.List;

/**
 * @Author dinghuapeng
 * @Date 2023/11/2 9:31
 * @PackageName:com.clm.mapper
 * @ClassName: SetmealDishMapper
 * @Description: TODO
 * @Version 1.0
 */
@Mapper
public interface SetmealDishMapper {

    /**
     * 根据菜品id查询对应的套餐id
     * 一个或多个菜品可以查找一个套餐
     * @param dishIds
     * @return
     */
    List<Long> getSetmealDishIdsBySetmealId(List<Long> dishIds);

    /**
     * 向关联的菜品表插入数据
     * @param setmealDishes
     */
    void insertSetmealDish(List<SetmealDish> setmealDishes);

    /**
     * 删除套餐相关的菜品数据
     * @param setmealId
     */
    @Delete("delete from  setmeal_dish where setmeal_id = #{setmealId}")
    void deleteBySetmealId(Long setmealId);

    /**
     * 根据套餐id查询相关菜品
     * 一个套餐多个菜品
     * @param
     * @return
     */
    @Select("select * from setmeal_dish where setmeal_id = #{setmealId}")
    List<SetmealDish> getBySetmealId(Long setmealId);
}
